<?=view('header.html')?>

<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-row">

            <div class="layui-card">

                <div class="layui-card-header">
                    会员分组设置
                </div>

                <div class="layui-card-body">
                    <form class="layui-form mokui-form" name="myform" id="myform">
                        
                        <div class="layui-tab layui-tab-card">

                            <ul class="layui-tab-title">
                                <li class="layui-this">基本设置</li>
                                <li>注册设置</li>
                            </ul>

                            <div class="layui-tab-content">

                                <!--1-->
                                <div class="layui-tab-item layui-show">

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">完善资料：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[complete]" <?php if((isset($data['complete']) && $data['complete']==1) || !isset($data['complete'])){echo 'checked';}?> title="必须" value="1">
                                            <input type="radio" name="data[complete]" <?php if(isset($data['complete']) && $data['complete']==0){echo 'checked';}?> title="不用" value="">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">是否完善资料才能正常使用会员功能</div>

                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">手机认证：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[ismobile]" <?php if((isset($data['ismobile']) && $data['ismobile']==1) || !isset($data['ismobile'])){echo 'checked';}?> title="必须" value="1">
                                            <input type="radio" name="data[ismobile]" <?php if(isset($data['ismobile']) && $data['ismobile']==0){echo 'checked';}?> title="不用" value="0">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">是否 必须手机认证 才能正常使用会员功能</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">邮件认证：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[isemail]" <?php if((isset($data['isemail']) && $data['isemail']==1) || !isset($data['isemail'])){echo 'checked';}?> title="必须" value="1">
                                            <input type="radio" name="data[isemail]" <?php if(isset($data['isemail']) && $data['isemail']==0){echo 'checked';}?> title="不用" value="0">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">是否 必须邮件认证 才能正常使用会员功能</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">实名认证：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[istruename]" <?php if((isset($data['istruename']) && $data['istruename']==1) || !isset($data['istruename'])){echo 'checked';}?> title="必须" value="1">
                                            <input type="radio" name="data[istruename]" <?php if(isset($data['istruename']) && $data['istruename']==0){echo 'checked';}?> title="不用" value="0">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">是否 必须实名认证 才能正常使用会员功能</div>
                                    </div>

                                </div>

                                <!--2-->
                                <div class="layui-tab-item">

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">会员注册：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[register]" <?php if((isset($data['register']) && $data['register']==1) || !isset($data['register'])){echo 'checked';}?> title="开启" value="1">
                                            <input type="radio" name="data[register]" <?php if(isset($data['register']) && $data['register']==0){echo 'checked';}?> title="关闭" value="0">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">邀请注册：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[invitecode]" <?php if((isset($data['invitecode']) && $data['invitecode']==1) || !isset($data['invitecode'])){echo 'checked';}?> title="必须" value="1">
                                            <input type="radio" name="data[invitecode]" <?php if(isset($data['invitecode']) && $data['invitecode']==0){echo 'checked';}?> title="不用" value="0">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">是否 必须有邀请码才能注册</div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">默认注册用户组：</label>
                                        <div class="layui-input-inline">
                                            <select name="data[groupid]">
                                                <option value="">默认注册用户组</option>
                                                <?php if(isset($group) && $group):?>
                                                <?php foreach($group as $g):?>
                                                <option value="<?=$g['id']?>" <?php if(isset($data['groupid']) && $data['groupid']==$g['id']){echo 'selected';}?>><?=$g['name']?></option>
                                                <?php endforeach;?>
                                                <?php endif;?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">新会员审核：</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="data[regverify]" <?php if((isset($data['regverify']) && $data['regverify']==1) || !isset($data['regverify'])){echo 'checked';}?> title="开启" value="1">
                                            <input type="radio" name="data[regverify]" <?php if(isset($data['regverify']) && $data['regverify']==0){echo 'checked';}?> title="关闭" value="0">
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">不允许注册的会员名：</label>
                                        <div class="layui-input-inline mokui-input-inline-md4">
                                            <textarea class="layui-textarea" name="data[regnotallow]"><?=isset($data['regnotallow']) ? $data['regnotallow'] : ''?></textarea>
                                        </div>
                                        <span class="layui-form-mid layui-word-aux">多个会员名以分号“,”分隔</span>
                                    </div>

                                </div>

                            </div>

                        </div>

                        <div class="layui-form-item" style="margin-top: 30px;">
                            <div class="layui-input-block ">
                                <button type="button" class="layui-btn layui-btn-blue" lay-submit="" lay-filter="ams_submit">提交保存</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
    <?=view('footer.html')?>
    <script type="text/javascript">
        layui.use(['layer', 'form', 'jquery', 'element'], function () {
            var layer = layui.layer,
                form = layui.form,
                $ = layui.jquery,
                element = layui.element;
            

            form.on('submit(ams_submit)', function (data) {
                var url = window.location.href;
                $.post(url, data.field, function (res) {
                    if (res.code == 0) {
                        layer.msg('操作成功， 正在刷新...', { time: 1500 }, function () {
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                }, 'json');
            });

            form.on('select(regrule)', function (data) {

                $('#ams_regnamerule').val(data.value);

            });

        });
    </script>
</body>

</html>
